﻿using DigitalHealth.PACS.ChatWebSocket.Services;
using DigitalHealth.PACS.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace DigitalHealth.PACS.ChatWebSocket.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    //[Authorize]
    public class ChatMessageController : ControllerBase
    {
        public IChatServer ChatServer { get; set; }

        public ChatMessageController(IChatServer chatServer)
        {
            ChatServer = chatServer;
        }

        // GET api/<ChatMessageController>/5
        [HttpGet]
        [Route("onechat/notread/{userid}")]
        public IEnumerable<MsgTemplate> GetNotReadChatMessage(string userid)
        {
            return ChatServer.GetNotReadChatMessage(userid);
        }

        [HttpGet]
        [Route("groupchat/notread/{userid}")]
        public IEnumerable<MsgTemplate> GetNotReadGroupChatMessage(string userid)
        {
            return ChatServer.GetNotReadGroupChatMessage(userid);
        }

        //// POST api/<ChatMessageController>
        //[HttpPost]
        //public void Post([FromBody] string value)
        //{
        //}

        //// PUT api/<ChatMessageController>/5
        //[HttpPut("{id}")]
        //public void Put(int id, [FromBody] string value)
        //{
        //}

        //// DELETE api/<ChatMessageController>/5
        //[HttpDelete("{id}")]
        //public void Delete(int id)
        //{
        //}
    }
}
